package proxy

type tMockUser struct {
	iID int
	sName string
	mPermissions map[string]bool
}

func NewMockUser(id int, name string, perms []string) IUser {
	it := &tMockUser{
		id, name, make(map[string]bool, 16),
	}
	for _,k := range perms {
		it.mPermissions[k] = true
	}
	return it
}


func (me *tMockUser) ID() int {
	return me.iID
}

func (me *tMockUser) Name() string {
	return me.sName
}

func (me *tMockUser) Allowed(perm string) bool {
	if me.mPermissions == nil {
		return false
	}

	_,ok := me.mPermissions[perm]
	return ok
}